package com.ym.b2b.user.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ym.b2b.commons.exception.BaseException;
import com.ym.b2b.commons.service.BaseService;
import com.ym.b2b.user.dao.EmMPassPolicyDAO;
import com.ym.b2b.user.service.EmMPassPolicyService;
import com.ym.b2b.user.sqlbean.EmMPassPolicy;
import com.zc.commons.base.Result;

@Service
public class EmMPassPolicyServiceImpl extends BaseService implements EmMPassPolicyService {

    @Autowired
    private EmMPassPolicyDAO emMPassPolicyDAO;

    @Override
    public Result searchEmMPassPolicy(EmMPassPolicy record) throws BaseException {
        Result result = new Result();
        try {
            EmMPassPolicy emMPassPolicy = emMPassPolicyDAO.searchEmMPassPolicy(record);
            result.putData("emMPassPolicy", emMPassPolicy);
            result.setResult("查询成功!");
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            throw new BaseException(Result.CODE_100, "查询失败!");
        }
        return result;
    }

    @Override
    public Result updateEmMPassPolicy(EmMPassPolicy record) {
        Result result = new Result();
        try {
            emMPassPolicyDAO.updateEmMPassPolicy(record);
            result.setResult("修改信息成功!");
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            throw new BaseException(Result.CODE_100, "修改信息失败!");
        }
        return result;
    }

}
